package org.hxyjs.dto;

import java.io.IOException;
import java.util.Properties;

/**
 * 主要用于存放各种提示信息
 * @author:LG
 * @date:Created at 2019/03/09
 */
//一个消息类 有两种成员变量一种是小写的可以改变的变量（读取properties文件），第二种是大小的不能改变的变量（提供给DTO）
public class Messages {
    private static String getAdminSuccess= "";
    private static String getAdminFail= "";
    private static String addAdminSuccess= "";
    private static String addAdminFail= "";
    private static String deleteAdminSuccess= "";
    private static String deleteAdminFail= "";
    private static String updateAdminSuccess= "";
    private static String updateAdminFail= "";
    //管理员结束
    private static String getNewsSuccess= "";
    private static String getNewsFail= "";
    private static String addNewsSuccess= "";
    private static String addNewsFail= "";
    private static String deleteNewsSuccess= "";
    private static String deleteNewsFail= "";
    private static String updateNewsSuccess= "";
    private static String updateNewsFail= "";
    //新闻结束




   static{
       Properties prop = new Properties();// 空的配置类
       try {
           prop.load(Messages.class.getResourceAsStream("/messages.properties"));// Object.class找到jvm运行的class文件所在的目录，
       } catch (IOException e) {
           e.printStackTrace();
       }
       // getResourceAsStream 以流的形式将文件读到内存，不写/ 根路径表示当前class所在的文件夹下面找文件 写
       // 根路径就是当前项目下面找文件 bin
       getAdminSuccess = prop.get("getAdminSuccess").toString();
       getAdminFail = prop.get("getAdminFail").toString();
       addAdminSuccess = prop.get("addAdminSuccess").toString();
       addAdminFail = prop.get("addAdminFail").toString();

       deleteAdminSuccess = prop.get("deleteAdminSuccess").toString();
       deleteAdminFail = prop.get("deleteAdminFail").toString();
       updateAdminSuccess = prop.get("updateAdminSuccess").toString();
       updateAdminFail = prop.get("updateAdminFail").toString();
        //管理员结束
       getNewsSuccess = prop.get("getNewsSuccess").toString();
       getNewsFail = prop.get("getNewsFail").toString();
       addNewsSuccess = prop.get("addNewsSuccess").toString();
       addNewsFail = prop.get("addNewsFail").toString();

       deleteNewsSuccess = prop.get("deleteNewsSuccess").toString();
       deleteNewsFail = prop.get("deleteNewsFail").toString();
       updateNewsSuccess = prop.get("updateNewsSuccess").toString();
       updateNewsFail = prop.get("updateNewsFail").toString();
       //新闻结束


   }
    /*学生模块操作信息*/
    public final static String GETADMINSUCCESS= getAdminSuccess;
    public final static String GETADMINFAIL= getAdminFail;
    public final static String ADDADMINSUCCESS= addAdminSuccess;
    public final static String ADDADMINFAIL= addAdminFail;

    public final static String DELETEADMINSUCCESS= deleteAdminSuccess;
    public final static String DELETEADMINFAIL= deleteAdminFail;
    public final static String UPDATEADMINSUCCESS= updateAdminSuccess;
    public final static String UPDATEADMINFAIL= updateAdminFail;
    //管理员结束
    public final static String GETNEWSSUCCESS= getNewsSuccess;
    public final static String GETNEWSFAIL= getNewsFail;
    public final static String ADDNEWSSUCCESS= addNewsSuccess;
    public final static String ADDNEWSFAIL= addNewsFail;

    public final static String DELETENEWSSUCCESS= deleteNewsSuccess;
    public final static String DELETENEWSFAIL= deleteNewsFail;
    public final static String UPDATENEWSSUCCESS= updateNewsSuccess;
    public final static String UPDATENEWSFAIL= updateNewsFail;
    //新闻结束


    public static void main(String[] args) {
        System.out.println(Messages.GETADMINFAIL);
    }
}
